*use "TESS_cleaned_replication.dta"

g sep_v_db = 1 if one==100
replace sep_v_db = 0 if db==100

g evan_db=1 if evan==100
replace evan_db=0 if db==100

keep if prot==1 | christian==1

g X=1

X

foreach i in female south married under30 over65 college rep cons trump16 romney12 trump_approve{
preserve
reg `i' sep_v_db  if (prot==1 | christian==1) [aw=WEIGHT]
		mat B = r(table)
		gen y= .
		gen se= .
		replace y = B[1,1] 
		replace se = B[2,1] 
collapse y se, by(X)
save "~/Dropbox/evangelical identities/Question wording - evangelical versus born again/TESS/Data/Final data/temp/`i'_evan.dta", replace
restore
}


foreach i in female south married under30 over65 college rep cons trump16 romney12 trump_approve{
preserve
reg `i' evan_db  if  (prot==1 | christian==1) [aw=WEIGHT]
		mat B = r(table)
		gen y= .
		gen se= .
		replace y = B[1,1] 
		replace se = B[2,1] 
collapse y se, by(X)
save "~/Dropbox/evangelical identities/Question wording - evangelical versus born again/TESS/Data/Final data/temp/`i'_evan2.dta", replace
restore
}

clear
cd "~/Dropbox/evangelical identities/Question wording - evangelical versus born again/TESS/Data/Final data/temp/"
use "trump_approve_evan2.dta"
append using "trump_approve_evan.dta"
append using "trump16_evan2.dta"
append using "trump16_evan.dta"
append using "romney12_evan2.dta"
append using "romney12_evan.dta"
append using "cons_evan2.dta"
append using "cons_evan.dta"
append using "rep_evan2.dta"
append using "rep_evan.dta"
append using "college_evan2.dta"
append using "college_evan.dta"
append using "over65_evan2.dta"
append using "over65_evan.dta"
append using "under30_evan2.dta"
append using "under30_evan.dta"
append using "married_evan2.dta"
append using "married_evan.dta"
append using "south_evan2.dta"
append using "south_evan.dta"
append using "female_evan2.dta"
append using "female_evan.dta"

g dv = _n
set obs 22
egen seq = fill(1 2 4 5 7 8 10 11 13 14 16 17 19 20 22 23 25 26 28 29 31 32) 
replace seq=31 if seq==30
replace seq=28 if seq==27
replace seq=25 if seq==24
replace seq=22 if seq==21
replace seq=19 if seq==18
seq type, f(1) t(2)

g lb=y-(1.95*se)
g ub=y+(1.95*se)

cd "~/Dropbox/evangelical identities/Question wording - evangelical versus born again/TESS/Figures/"

gr tw (scatter seq y if type==1, col(gs6) msymbol(square) msize(small)) (rcap ub lb seq if type==1, hor col(gs6) lpattern(solid) lwidth(thin)) ///
(scatter seq y if type==2, col(gs12) msymbol(circle) msize(small)) (rcap ub lb seq if type==2, hor col(gs12) lpattern(dash) lwidth(medthin)), ///
legend(off) ///
ylabel(none) xlabel(none, labsize(medium)) title("Demographic and political differences based on measurement strategy" "(full sample)", size(medium)) legend(off) ///
xscale(range(-.4 0.3)) ///
xlabel(-0.1(0.10)0.3, nogrid) scheme(lean2) ///
ytitle("") xline(0, lpattern(dot) lcol(black) lwidth(medthick)) ///
text(1.5 -0.25 "Trump approval", size(medsmall)) ///
text(4.5 -0.25 "Trump vote '16", size(medsmall)) ///
text(7.5 -0.25 "Romney vote '12", size(medsmall)) ///
text(10.5 -0.25 "Conservative", size(medsmall)) ///
text(13.5 -0.25 "Republican", size(medsmall)) ///
text(16.5 -0.25 "College degree", size(medsmall)) ///
text(19.5 -0.25 "Age 65+", size(medsmall)) ///
text(22.5 -0.25 "Age < 30", size(medsmall)) ///
text(25.5 -0.25 "Married", size(medsmall)) ///
text(28.5 -0.25 "Resides in South", size(medsmall)) ///
text(31.5 -0.25 "Female", size(medsmall)) ///
text(2.15 0.12 "Union versus DB", size(medsmall)) ///
text(1 0.22 "Evan versus DB", size(medsmall)) ///
text(24 -.35 "Demographics", size(medsmall) orient(vertical)) ///
text(7.5 -.35 "Politics", size(medsmall) orient(vertical)) ///
yline(15, lcolor(black) lstyle(dot)) 
